package com.ymatou.query.trading.api.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetOrderHistoryBean;
import com.ymatou.query.trading.api.service.GetOrderHistoryCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.constant.ECode;

/**
 * 获取订单历史 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetOrderHistory {

	private static GetOrderHistoryBean getorderhistorybean;
	private static GetOrderHistoryCall getorderhistorycall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取订单历史");
	}

	@Before
	public void caseUp() {

		getorderhistorybean = new GetOrderHistoryBean();
		getorderhistorycall = new GetOrderHistoryCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getorderhistorycall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderHistory_001() {
		Logger.start(true,"获取订单历史成功");
		try {
			int UserId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			// 参数
			getorderhistorybean.setOrderId(105251834);
			getorderhistorybean.setUserId(1113);
			// 发送请求
			getorderhistorycall.setData(getorderhistorybean);
			getorderhistorycall.callService();
			Logger.comment("getorderhistorycall send:" + getorderhistorycall.getEntityString());
			Logger.comment("getorderhistorycall response:" + getorderhistorycall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getorderhistorycall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getorderhistorycall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}